﻿using Autofac;
using Core.Infrastructures.Cores.DataStore;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace Core.Infrastructures.Cores.Injections.Modules
{
    public partial class DataAccessModule : Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterType<DataAccessor>().As<IDataAccessor>().InstancePerLifetimeScope();    // 注册数据库访问器，并设置基于请求创建
            builder.RegisterType<SqlSugarClient>().As<ISqlSugarClient>().WithParameter(new TypedParameter(typeof(ConnectionConfig), new ConnectionConfig()
            {
                DbType = DbType.SqlServer
            })).InstancePerLifetimeScope(); // 注册数据库操作对象，设置基于请求创建
        }
    }
}
